using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.IO;
using System.Xml.Serialization;

namespace Pibby.Core
{
	/// <summary>
	/// A representation of how much somebody likes a particular podcast.
	/// Having episodes published more often, downloading more episodes and
	/// transferring more episodes in relation to others makes for higher whuffie.
	/// For an explanation of exactly what Whuffie is see Cory Doctorow's 
	/// "Down and Out in the Magic Kingdom" - http://craphound.com/
	/// </summary>
	public class Whuffie
	{
		private int _score;

		#region Properties

		public int Score
		{
			get { return this._score; }
			set
			{
				// we can't go negative
				if (value >= 0)
					this._score = value;
				else
					this._score = 0;
			}
		}

		#endregion Properties

		#region Accumulating it

		public void Esteem()
		{
			++this.Score;
		}

		public void Esteem(int delta)
		{
			this.Score += delta;
		}

		#endregion

		#region Using it up

		public void Expend()
		{
			--this.Score;
		}

		public void Expend(int delta)
		{
			this.Score -= delta;
		}

		#endregion
    }


}
